package com.aaa.day1104.demo1;

import java.util.function.Function;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月04日10:10
 */
public class Test4 {
    public static void main(String[] args) {

        Function<String,Dog> function=(t)->new Dog(t);
        Dog dog=function.apply("旺财");
        System.out.println("dog = " + dog);

        Function<String,Dog> f=Dog::new;
        Dog d=function.apply("旺财");
        System.out.println("d = " + d);


    }
}
class Dog{
    private String name;

    public Dog(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                '}';
    }
}